﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TjZheng.Example.MVC.Models;
using TjZheng.Logging;
using TjZheng.Mvc;

namespace TjZheng.Example.MVC.Controllers
{
    public class ActionController : TjZhengController
    {
        public ActionResult Index()
        {
            //SysAsset.CreateHttp404Result("对不起，页面被偷走了");
            //return Http404();
            //string.Format("{0}");
            return Redirect("/Action/RedirectStatus");//301
            //return RedirectPermanent("/Action/RedirectStatus");//302
        }

        public ActionResult RedirectStatus()
        {
            return Content(Response.Status);
        }

        public ActionResult UpAction()
        {
            return View();
        }

        public ActionResult MainAction()
        {
            return View();
        }

        public ActionResult DownAction()
        {
            return View();
        }

        public ActionResult JsonpTest()
        {
            return Jsonp(new ZooEntity
            {
                zoo = "zoo",
                bar = "bar",
                baz = "baz"
            }, JsonRequestBehavior.AllowGet);
        }

        [CorsFilter("http://tjzheng.webapi.com","http://www.baidu.com")]
        public ActionResult CrossDomain(string s1, string s2)
        {
            return Json(new ZooEntity
            {
                zoo = s1,
                bar = s2,
                baz = "baz"
            }, JsonRequestBehavior.AllowGet);
        }
    }
}
